import { transfer } from '@/utils/handleParams.js'
import { factory } from '@/utils/factory.js'

const query = {
    "list": [
        "objId",
        "province",
        "localNet",
        "createTime"
    ],
    "submitArrName": "conditions",
    "submitKey": "field",
    "submitValueKey": "value"
}
export default [{
            "title": "用户管理",
            "showLogic": "",
            "fields": [
                { "label": "用户名称", "labelWidth": "70px", "prop": "taskId:like", "showIn":["table", "query", "add"], "tag": "input", "config":
                    {
                        "clearable": true, "placeholder": "请输入用户名称", rules: [
                            { required: true, message: '请输入用户名称', trigger: 'blur' }
                        ]
                    }
                },
                { "label": "手机号码", "prop": "phone", "showIn":["table", "query", "add"], 'config': {
                    "tableLogic": "obj?.phone == '3' # rowClass('p-1')",
                }},
                { "label": "状态", "prop": "status", "showIn":["table", "query", "add"], "tag": "select",
                    "config": {
                        "reqField": "status",
                        "enums": {
                            "active": '激活',
                            "inactive": '禁用',
                            "blocked": '锁定'
                        }
                    }
                },
                { "label": "稽查周期", "prop": "LogTime", "showIn":["table", "query", "add"], "tag": "yearrange", config: {
                    "placeholder": "请选择日期范围",
                    "reqField": "logTime"
                }},
                /* {"type": "slot", "showIn":["table"], "label": "状态"}, */
                { "label": "邮箱", "prop": "email"},
                { "label": "地址", "prop": "address"},
                { "label": "创建时间", "prop": "createdAt", "showIn":["table", "query", "add"], "tag": "monthrange"},
                { "label": "修改时间", "prop": "updatedAt | dateFormatter2YMDHMS"}
            ],
            "operations": {
                "default": [
                    {
                        "label": "创建任务", "btnClass": "add", "actOn": "operation", "rangeFn": "fetch",
                        "request": { "url": "/auditPortal/telQYProcessTask/createTask", "method": "post", "successMsg": "创建成功", "successKey": "returnCode", "successCode": '0',
                            "successCb": { "actOn": "table", "rangeFn": "update", "request": {"url": "/auditPortal/telQYProcessTask/search", "method": "post" }, "params": {}}
                        }
                    },
                    {
                        "label": "导入", "actOn": "dialog", "rangeFn": "open", "isClosedRemoveDom": true,
                        "fields": [
                            {
                                "label": "导入文件", "prop": "file", "tag": "fileUpload", "config": {
                                    "tip": "请上传文件",
                                    "accept": "xlsx,xls",
                                    "listType": "text",
                                    "limit": 1,
                                    "url": "/auditPortal/common/attach/upload", "headers": {
                                        "Authorization": "Bearer " + localStorage.getItem("token")
                                    },
                                    "urlDel": '/auditPortal/common/attach/delete',
                                    'handleDelParams': (obj) => {
                                        return {filename: obj.response.resBody};
                                    },
                                    successDelLogic: "obj?.returnCode == '0'",
                                }
                            },
                            {
                                "label": "文件名称", "prop": "taskName",
                                method: obj => {
                                    return `号码状态稽查任务_${factory.dateFormatter2YMDHMS(new Date())}`;
                                },
                                "config": {
                                    "clearable": true, "placeholder": "请输入用户名称",
                                }
                            },
                        ],
                        "operations": [
                            {
                                "label": "确认", "actOn": "dialog", "rangeFn": "commit", "isCloseDialog": true,
                                "request": {
                                    "url": "/auditPortal/telStatusTask/createTask", "method": "post",
                                    beforeExcuteJs: data => {
                                        const { file } = data;
                                        let key
                                        file.forEach(el => {
                                            key = el.response.resBody;
                                        })
                                        delete data.file;
                                        data.attachId = key;
                                        return data;
                                    },
                                    successMsg: "创建成功",
                                    successLogic: "obj?.returnCode == '0'",
                                    successCb: {"actOn": "table", "rangeFn": "update", "request": {"url": "/auditPortal/telStatusTask/search", "method": "post" }}
                                }
                            }, {
                                "label": "取消", "rangeFn": "close", "actOn": "dialog", "isPlain": true
                            }
                        ]
                    },
                    {
                        "label": "导出", "actOn": "query", "rangeFn": "getData", hookFn: "export"
                    },
                    {
                        'button': {"label": "新增", "type": "primary", "icon": "Plus", "class": "btn-add"}, attr: "add",
                        "title": "新增用户", "actOn": "dialog", "rangeFn": "open",
                        "operations": [{
                            "label": "确认", "actOn": "dialog", "rangeFn": "commit", 'hookFn': 'edit',
                            /*  "operationLogic": "obj?.name == 2", "request": { "url": "/api/user/create", "method": "post", "successMsg": "创建成功！", "successCb":
                                { "actOn": "table", "rangeFn": "update", "request": {"url": "/api/user/query", "method": "post" }, "params": {}},
                            } */

                        }, {
                            "label": "取消", "rangeFn": "close", "actOn": "dialog", "isPlain": true
                        }]
                    }, {
                        "label": "table处理", "actOn": "table", isQueryData: true, "rangeFn": "update", "operationLogic": "[1,2,4,5,3].filter(el => obj?.rid.includes(el)).length>0;",
                        "request": { "url": "/auditPortal/telQYProcessResult/search", "method": "post", "fields": ["id", "name", "phone", "groupId"] }
                    }, {
                        "label": "按钮下拉", "actOn": "table", "rangeFn": "getSelection",
                        "dropdownMenus": [
                            {
                                "label": "新增", "actOn": "dialog", "rangeFn": "open", 
                                "fields": [{"label": "姓名", "prop": "name", "tag": "input"}, {"label": "年龄", "prop": "age", "tag": "input"}],
                                "operations": [{
                                    "label": "确认", "actOn": "dialog", "rangeFn": "commit", "operationLogic": "obj?.name == 2",
                                    "request": { "url": "/api/user/query", "method": "post" }
                                    }, {
                                    "label": "取消", "actOn": "dialog", "rangeFn": "close"
                                    }
                                ]
                            }
                        ]
                    }, {
                        "label": "query处理", "actOn": "query", "rangeFn": "getData", "request": { "url": "/api/user/query", "method": "post" }
                    }, {
                        "label": "table + dialog处理", "actOn": "table", "rangeFn": "getLength", 
                        "next": {
                            "label": "table + dialog处理", "actOn": "dialog", "rangeFn": "open", "headTip": "处理${selectedSize}",
                            "fields": [{"label": "姓名", "prop": "name", "tag": "input"}, {"label": "年龄", "prop": "age", "tag": "input"}, {"label": "性别", "prop": "sex", "tag": "input"}],
                            "operations": [{
                                    "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                                    "request": { "url": "/api/user/query", "method": "post" }
                                }, {
                                    "label": "取消", "actOn": "dialog", "rangeFn": "close"
                                }
                            ]
                        }
                    }, {
                        "label": "query + dialog请求", "actOn": "query", "rangeFn": "getData",
                        "next": {
                            "label": "query + dialog处理", "actOn": "dialog", "rangeFn": "open",
                            "fields": [{"label": "手机号", "prop": "phone", "tag": "input"}, {"label": "邮箱", "prop": "email", "tag": "input"}, {"label": "地址", "prop": "address", "tag": "input"}],
                            "operations": [{
                                    "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                                    "request": { "url": "/api/user/query", "method": "post" }
                                }, {
                                    "label": "取消", "actOn": "dialog", "rangeFn": "close"
                                }
                            ]
                        }
                    }, {
                        "label": "query + table + dialog请求", "actOn": "query", "rangeFn": "getData",
                        "next": {
                            "actOn": "table", "rangeFn": "getSelection", 
                            "next": {
                                "actOn": "dialog", "rangeFn": "open", "label": "query + table + dialog处理",
                                "fields": [
                                    {"label": "姓名", "prop": "name", "tag": "input"},
                                    {"label": "年龄", "prop": "age", "tag": "input"},
                                    {"label": "电话", "prop": "phone", "tag": "input"},
                                    {"label": "性别", "prop": "sex", "tag": "input"}
                                ],
                                "operations": [{
                                    "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                                    "request": { "url": "/api/user/query", "method": "post" }
                                    }, {
                                    "label": "取消", "actOn": "dialog", "rangeFn": "close"
                                    }, {
                                        "label": "下一步", "actOn": "dialog", "rangeFn": "getData",
                                        "next": {
                                            "actOn": "dialog", "rangeFn": "open",
                                            "fields": [
                                                {"label": "姓名1", "prop": "name1", "tag": "input"},
                                                {"label": "年龄2", "prop": "age1", "tag": "input"},
                                                {"label": "电话3", "prop": "phone1", "tag": "input"},
                                                {"label": "性别4", "prop": "sex1", "tag": "input"}
                                            ],
                                            "operations": [{
                                                "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                                                "request": { "url": "/api/user/query", "method": "post" }
                                                }, {
                                                "label": "取消", "actOn": "dialog", "rangeFn": "close"
                                                },{
                                                    "label": "下一步", "actOn": "dialog", "rangeFn": "getData",
                                                    "next": {
                                                        "actOn": "dialog", "rangeFn": "open",
                                                        "fields": [
                                                            {"label": "姓名11", "prop": "name2", "tag": "input"},
                                                            {"label": "年龄22", "prop": "age2", "tag": "input"},
                                                            {"label": "电话33", "prop": "phone2", "tag": "input"},
                                                            {"label": "性别44", "prop": "sex2", "tag": "input"}
                                                        ],
                                                        "operations": [{
                                                            "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                                                            "request": { "url": "/api/user/query", "method": "post" }
                                                            }, {
                                                            "label": "取消", "actOn": "dialog", "rangeFn": "close"
                                                        }]
                                                    }
                                                }]
                                        }
                                    }
                                ],
                            }
                        }
                    },
                    {
                        "label": "自定义处理", "actOn": "query", "rangeFn": "getData", "next": {
                            "actOn": "table", "rangeFn": "getSelection", "rangeFnExcuteJs": "function(obj) {console.log(obj);return obj}(obj)", "next": {
                                "isCustom": true, "request": { "url": "/api/user/query", "method": "post" }
                            }
                        }
                    },
                    {
                        "label": "自定义处理1", "actOn": "query", "rangeFn": "getData", "hookFn": 'edit'
                    }
                ],
                "table": [
                    { "label": "编辑", "actOn": "dialog", "rangeFn": "open", "showLogic": "obj.status && obj.status == 'active'", "btnClass": "edit",
                        "fields": [
                            {"label": "用户ID", "prop": "taskID", "config": {
                                "disabled": true
                            }},
                            {"label": "用户名称", "prop": "name"},
                            {"label": "手机号码", "prop": "phone"},
                            {"label": "角色", "prop": "roleName", "tag": "select", "config": 
                                {
                                    "reqField": "roleId",
                                    "enum": {
                                        "b578e8c0e8295ec295e7cc89447271ab": '管理员',
                                        "9886d03139161f1329dfb6049e3a1910": '普通用户',
                                        "70545e008dd490edea15bdd228e566fc": '超级管理员'
                                    }
                                }
                            },
                            { "label": "所属部门", "prop": "zoneId", "tag": "asyncSelect", "config":
                                {
                                    "url": "/api/zone/select", "method": "post", "fieldKey": "name", "fieldValue": "id",
                                }
                            },
                            { "label": "所属组", "prop": "groupId", "tag": "asyncSelect", "config":
                                {
                                    "url": "/api/group/select", "method": "post", "fieldKey": "name", "fieldValue": "id",
                                }
                            },
                            { "label": "所属岗位", "prop": "postId", "tag": "asyncSelect", "config":
                                {
                                    "url": "/api/post/select", "method": "post", "fieldKey": "name", "fieldValue": "id",
                                }
                            },
                            { "label": "备注", "prop": "description", "config":
                                {
                                    "type": "textarea",
                                }
                            }
                        ],
                        "operations": [{
                            "label": "确认", "rangeFn": "commit", "actOn": "dialog", "isCloseDialog": true, hookFn: 'test',
                            // "request": { "url": "/user/update", "method": "post", "fetchMsg": "创建成功！", "successCb": { "actOn": "table", "rangeFn": "update", "request": {"url": "/user/query", "method": "post" }, "params": {}}}
                        }, {
                            "label": "取消", "actOn": "dialog", "rangeFn": "close"
                        }]
                    },
                    { "label": "日志", "actOn": "dialog", "rangeFn": "open", 'dialogType': 'table',
                        'method': (obj, data) => {console.log('js---method', obj, data);data['tableData'] = data.taskLogs;console.log('js---method', data);},
                        "fields": [
                            {"label": "用户ID", "prop": "id", "config": {
                                "disabled": true
                            }},
                            {"label": "用户名称", "prop": "name"},
                            {"label": "手机号码", "prop": "phone"}
                        ],
                        "operations": [{
                            "label": "取消", "actOn": "dialog", "rangeFn": "close"
                        }]
                    },
                    {"label": "详情", hookFn:'detail', link: "/detail?_query_={taskId: ${objId}}"},
                    {  "label": "删除", "type": "danger", "isCustom": true, 
                       "actOn": "table", "rangeFn": "onceFetch", /* "request": { "url": "/api/user/del/${id}", "method": "post", "successCb": { "rangeFn": "update", "request": {"url": "/user/query", "method": "post" }, "params": {}
                        }} */
                    },
                    {
                        "label": "下载", "actOn": "table", "rangeFn": "fetch", "btnClass": "add", "request": {
                            "url": '/auditPortal/telQYProcessResult/search',// "/auditPortal/common/attach/getTmp",
                            "method": "post",
                            // "responseType": "blob",
                            "downloadFormat": '.csv.gz',
                            "downloadNameField": 'taskName',
                            "fields": ['attachId', 'taskName'],
                            "beforeExcuteJsStr": "function(obj){obj.filename = obj.attachId;delete obj.attachId;return obj;}(obj)",
                            "fetchMsg": "下载请求已发送！"
                        }
                    },
                    {
                        "label": "上传", "title": "文件", "actOn": "dialog", "rangeFn": "open",
                        "fields": [
                            { "label": "用户名称", "labelWidth": "70px", "prop": "taskId", "showIn":["table", "query"], "tag": "input", "config":
                                {
                                    "clearable": true, "placeholder": "请输入用户名称"
                                }
                            },
                            {
                                "label": "导入文件", "prop": "file", "tag": "fileUpload", "config": {
                                    "tip": "请上传文件",
                                    "accept": "xlsx,xls",
                                    "listType": "text",
                                    "limit": 1,
                                    "url": "/auditPortal/common/attach/upload", "headers": {
                                        "Authorization": "Bearer " + localStorage.getItem("token")
                                    }
                                }
                            },
                        ],
                        "operations": [
                            {
                                "label": "确认", "actOn": "dialog", "rangeFn": "commit", "isCloseDialog": true,
                                "request": {
                                    "url": "/auditPortal/billDurationTask/createTask", "method": "post", "fields": ["attachId", "file", "objId"],
                                    beforeExcuteJs: data => {
                                        console.log('beforeExcuteJs---', data);
                                        const { file } = data;
                                        let key
                                        file?.forEach(el => {
                                            key = el.response.resBody;
                                        })
                                        delete data.file;
                                        data.attachId = key;
                                        data.taskId = data.objId;
                                        return data;
                                    },
                                    successMsg: "成功创建稽查任务",
                                    successLogic: "obj?.returnCode == '0'",
                                    successCb: {"actOn": "table", "rangeFn": "update", "request": {"url": "/auditPortal/billDurationTask/search", "method": "post", successMsg: "成功刷新列表", }}
                                }
                            }, {
                                "label": "取消", "rangeFn": "close", "actOn": "dialog", "isPlain": true
                            },
                        ]
                    },
                ],
                "query": [
                    { "label": "重置","actOn": "query", "rangeFn": "reset", "btnClass": "reset" },
                    { "label": "查询", "actOn": "table", "icon": 'search', "rangeFn": "update", "notQueryData": true, "btnLoading": true, "request": {
                        "url": "/auditPortal/telQYProcessTask/search",
                        "method": "post",
                        "params": {"pageNum": 1},
                        beforeExcuteJs: data => {
                            data.objId = data.taskId;
                            // delete data.taskId;
                            return transfer.obj2Arr(query, data);
                        },
                        "beforeExcuteJsStr": "function(obj){return obj;}(obj)",
                        "afterExcuteJsStr": "function(obj){obj.body.forEach((el,idx) => {el.name = {'a': idx}});console.log(obj);return obj;}(obj)"
                    }
                }]
            },
            "config": {
                "table": {
                    "pageFields": {
                        "size": 30
                    },
                },
                "query": {
                    labelWidth: 70
                }
            }
},{
    "title": "用户管理",
    "showLogic": "",
    "fields": [
        { "label": "用户名称", "labelWidth": "70px", "prop": "taskId:like", "showIn":["table", "query"], "tag": "input", "config":
            {
                "clearable": true, "placeholder": "请输入用户名称"
            }
        },
        { "label": "手机号码", "prop": "phone", "showIn":["table", "query"], 'config': {
            "tableLogic": "obj?.phone == '3' # rowClass('p-1')",
        }},
        { "label": "状态", "prop": "status", "showIn":["table", "query"], "tag": "select",
            "config": {
                "reqField": "status",
                "enums": {
                    "active": '激活',
                    "inactive": '禁用',
                    "blocked": '锁定'
                }
            }
        },
        { "label": "稽查周期", "prop": "LogTime", "showIn":["table", "query"], "tag": "daterange", config: {
            "placeholder": "请选择日期范围",
            "reqField": "logTime"
        }},
        /* {"type": "slot", "showIn":["table"], "label": "状态"}, */
        { "label": "邮箱", "prop": "email"},
        { "label": "地址", "prop": "address"},
        { "label": "创建时间", "prop": "createdAt | dateFormatter2YMDHMS", "showIn":["table", "query"], "tag": "datetimerange"},
        { "label": "修改时间", "prop": "updatedAt | dateFormatter2YMDHMS"}
    ],
    "operations": {
        "default": [
            {
                "label": "创建任务", "btnClass": "add", "actOn": "operation", "rangeFn": "fetch",
                "request": { "url": "/auditPortal/telQYProcessTask/createTask", "method": "post", "successMsg": "创建成功", "successKey": "returnCode", "successCode": '0',
                    "successCb": { "actOn": "table", "rangeFn": "update", "request": {"url": "/auditPortal/telQYProcessTask/search", "method": "post" }, "params": {}}
                }
            },
            {
                "label": "导入", "actOn": "dialog", "rangeFn": "open", "isClosedRemoveDom": true,
                "fields": [
                    {
                        "label": "导入文件", "prop": "file", "tag": "fileUpload", "config": {
                            "tip": "请上传文件",
                            "accept": "xlsx,xls",
                            "listType": "text",
                            "limit": 1,
                            "url": "/auditPortal/common/attach/upload", "headers": {
                                "Authorization": "Bearer " + localStorage.getItem("token")
                            },
                            "urlDel": '/auditPortal/common/attach/delete',
                            'handleDelParams': (obj) => {
                                return {filename: obj.response.resBody};
                            },
                            successDelLogic: "obj?.returnCode == '0'",
                        }
                    },
                    {
                        "label": "文件名称", "prop": "taskName",
                        method: obj => {
                            return `号码状态稽查任务_${factory.dateFormatter2YMDHMS(new Date())}`;
                        },
                        "config": {
                            "clearable": true, "placeholder": "请输入用户名称",
                        }
                    },
                ],
                "operations": [
                    {
                        "label": "确认", "actOn": "dialog", "rangeFn": "commit", "isCloseDialog": true,
                        "request": {
                            "url": "/auditPortal/telStatusTask/createTask", "method": "post",
                            beforeExcuteJs: data => {
                                const { file } = data;
                                let key
                                file.forEach(el => {
                                    key = el.response.resBody;
                                })
                                delete data.file;
                                data.attachId = key;
                                return data;
                            },
                            successMsg: "创建成功",
                            successLogic: "obj?.returnCode == '0'",
                            successCb: {"actOn": "table", "rangeFn": "update", "request": {"url": "/auditPortal/telStatusTask/search", "method": "post" }}
                        }
                    }, {
                        "label": "取消", "rangeFn": "close", "actOn": "dialog", "isPlain": true
                    }
                ]
            },
            {
                "label": "导出", "actOn": "query", "rangeFn": "getData", hookFn: "export"
            },
            {
                'button': {"label": "新增", "type": "primary", "icon": "Plus", "class": "btn-add"},
                "title": "新增用户", "actOn": "dialog", "rangeFn": "open", 
                "fields": [
                    {"label": "用户名称", "prop": "name", "config": {
                        "rules": [{ "required": true, "message": '请输入用户名称', "trigger": 'blur' }]
                    }},
                    {"label": "昵称", "prop": "nickName"},
                    {"label": "密码", "prop": "password"},
                    {"label": "手机号码", "prop": "phone"},
                    {"label": "邮箱", "prop": "email"},
                    {"label": "地址", "prop": "address"},
                    {"label": "状态", "prop": "status", "tag": "select",
                        "config": {
                            "reqField": "status",
                            "enums": {
                                "active": '激活',
                                "inactive": '禁用',
                                "blocked": '锁定'
                            }
                        }
                    }
                ],
                "operations": [{
                    "label": "确认", "actOn": "dialog", "rangeFn": "commit", 'hookFn': 'edit',
                    /*  "operationLogic": "obj?.name == 2", "request": { "url": "/api/user/create", "method": "post", "successMsg": "创建成功！", "successCb":
                        { "actOn": "table", "rangeFn": "update", "request": {"url": "/api/user/query", "method": "post" }, "params": {}},
                    } */

                }, {
                    "label": "取消", "rangeFn": "close", "actOn": "dialog", "isPlain": true
                }]
            }, {
                "label": "table处理", "actOn": "table", isQueryData: true, "rangeFn": "update", "operationLogic": "[1,2,4,5,3].filter(el => obj?.rid.includes(el)).length>0;",
                "request": { "url": "/auditPortal/telQYProcessResult/search", "method": "post", "fields": ["id", "name", "phone", "groupId"] }
            }, {
                "label": "按钮下拉", "actOn": "table", "rangeFn": "getSelection",
                "dropdownMenus": [
                    {
                        "label": "新增", "actOn": "dialog", "rangeFn": "open", 
                        "fields": [{"label": "姓名", "prop": "name", "tag": "input"}, {"label": "年龄", "prop": "age", "tag": "input"}],
                        "operations": [{
                            "label": "确认", "actOn": "dialog", "rangeFn": "commit", "operationLogic": "obj?.name == 2",
                            "request": { "url": "/api/user/query", "method": "post" }
                            }, {
                            "label": "取消", "actOn": "dialog", "rangeFn": "close"
                            }
                        ]
                    }
                ]
            }, {
                "label": "query处理", "actOn": "query", "rangeFn": "getData", "request": { "url": "/api/user/query", "method": "post" }
            }, {
                "label": "table + dialog处理", "actOn": "table", "rangeFn": "getLength", 
                "next": {
                    "label": "table + dialog处理", "actOn": "dialog", "rangeFn": "open", "headTip": "处理${selectedSize}",
                    "fields": [{"label": "姓名", "prop": "name", "tag": "input"}, {"label": "年龄", "prop": "age", "tag": "input"}, {"label": "性别", "prop": "sex", "tag": "input"}],
                    "operations": [{
                            "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                            "request": { "url": "/api/user/query", "method": "post" }
                        }, {
                            "label": "取消", "actOn": "dialog", "rangeFn": "close"
                        }
                    ]
                }
            }, {
                "label": "query + dialog请求", "actOn": "query", "rangeFn": "getData",
                "next": {
                    "label": "query + dialog处理", "actOn": "dialog", "rangeFn": "open",
                    "fields": [{"label": "手机号", "prop": "phone", "tag": "input"}, {"label": "邮箱", "prop": "email", "tag": "input"}, {"label": "地址", "prop": "address", "tag": "input"}],
                    "operations": [{
                            "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                            "request": { "url": "/api/user/query", "method": "post" }
                        }, {
                            "label": "取消", "actOn": "dialog", "rangeFn": "close"
                        }
                    ]
                }
            }, {
                "label": "query + table + dialog请求", "actOn": "query", "rangeFn": "getData",
                "next": {
                    "actOn": "table", "rangeFn": "getSelection", 
                    "next": {
                        "actOn": "dialog", "rangeFn": "open", "label": "query + table + dialog处理",
                        "fields": [
                            {"label": "姓名", "prop": "name", "tag": "input"},
                            {"label": "年龄", "prop": "age", "tag": "input"},
                            {"label": "电话", "prop": "phone", "tag": "input"},
                            {"label": "性别", "prop": "sex", "tag": "input"}
                        ],
                        "operations": [{
                            "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                            "request": { "url": "/api/user/query", "method": "post" }
                            }, {
                            "label": "取消", "actOn": "dialog", "rangeFn": "close"
                            }, {
                                "label": "下一步", "actOn": "dialog", "rangeFn": "getData",
                                "next": {
                                    "actOn": "dialog", "rangeFn": "open",
                                    "fields": [
                                        {"label": "姓名1", "prop": "name1", "tag": "input"},
                                        {"label": "年龄2", "prop": "age1", "tag": "input"},
                                        {"label": "电话3", "prop": "phone1", "tag": "input"},
                                        {"label": "性别4", "prop": "sex1", "tag": "input"}
                                    ],
                                    "operations": [{
                                        "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                                        "request": { "url": "/api/user/query", "method": "post" }
                                        }, {
                                        "label": "取消", "actOn": "dialog", "rangeFn": "close"
                                        },{
                                            "label": "下一步", "actOn": "dialog", "rangeFn": "getData",
                                            "next": {
                                                "actOn": "dialog", "rangeFn": "open",
                                                "fields": [
                                                    {"label": "姓名11", "prop": "name2", "tag": "input"},
                                                    {"label": "年龄22", "prop": "age2", "tag": "input"},
                                                    {"label": "电话33", "prop": "phone2", "tag": "input"},
                                                    {"label": "性别44", "prop": "sex2", "tag": "input"}
                                                ],
                                                "operations": [{
                                                    "label": "确认", "actOn": "dialog", "rangeFn": "commit",
                                                    "request": { "url": "/api/user/query", "method": "post" }
                                                    }, {
                                                    "label": "取消", "actOn": "dialog", "rangeFn": "close"
                                                }]
                                            }
                                        }]
                                }
                            }
                        ],
                    }
                }
            },
            {
                "label": "自定义处理", "actOn": "query", "rangeFn": "getData", "next": {
                    "actOn": "table", "rangeFn": "getSelection", "rangeFnExcuteJs": "function(obj) {console.log(obj);return obj}(obj)", "next": {
                        "isCustom": true, "request": { "url": "/api/user/query", "method": "post" }
                    }
                }
            },
            {
                "label": "自定义处理1", "actOn": "query", "rangeFn": "getData", "hookFn": 'edit'
            }
        ],
        "table": [
            { "label": "编辑", "actOn": "dialog", "rangeFn": "open", "showLogic": "obj.status && obj.status == 'active'", "btnClass": "edit",
                "fields": [
                    {"label": "用户ID", "prop": "taskID", "config": {
                        "disabled": true
                    }},
                    {"label": "用户名称", "prop": "name"},
                    {"label": "手机号码", "prop": "phone"},
                    {"label": "角色", "prop": "roleName", "tag": "select", "config": 
                        {
                            "reqField": "roleId",
                            "enum": {
                                "b578e8c0e8295ec295e7cc89447271ab": '管理员',
                                "9886d03139161f1329dfb6049e3a1910": '普通用户',
                                "70545e008dd490edea15bdd228e566fc": '超级管理员'
                            }
                        }
                    },
                    { "label": "所属部门", "prop": "zoneId", "tag": "asyncSelect", "config":
                        {
                            "url": "/api/zone/select", "method": "post", "fieldKey": "name", "fieldValue": "id",
                        }
                    },
                    { "label": "所属组", "prop": "groupId", "tag": "asyncSelect", "config":
                        {
                            "url": "/api/group/select", "method": "post", "fieldKey": "name", "fieldValue": "id",
                        }
                    },
                    { "label": "所属岗位", "prop": "postId", "tag": "asyncSelect", "config":
                        {
                            "url": "/api/post/select", "method": "post", "fieldKey": "name", "fieldValue": "id",
                        }
                    },
                    { "label": "备注", "prop": "description", "config":
                        {
                            "type": "textarea",
                        }
                    }
                ],
                "operations": [{
                    "label": "确认", "rangeFn": "commit", "actOn": "dialog", "isCloseDialog": true, hookFn: 'test',
                    // "request": { "url": "/user/update", "method": "post", "fetchMsg": "创建成功！", "successCb": { "actOn": "table", "rangeFn": "update", "request": {"url": "/user/query", "method": "post" }, "params": {}}}
                }, {
                    "label": "取消", "actOn": "dialog", "rangeFn": "close"
                }]
            },
            { "label": "日志", "actOn": "dialog", "rangeFn": "open", 'dialogType': 'table',
                'method': (obj, data) => {console.log('js---method', obj, data);data['tableData'] = data.taskLogs;console.log('js---method', data);},
                "fields": [
                    {"label": "用户ID", "prop": "msg", "config": {
                        "disabled": true
                    }},
                    {"label": "用户名称", "prop": "name"},
                    {"label": "手机号码", "prop": "phone"}
                ],
                "operations": [{
                    "label": "取消", "actOn": "dialog", "rangeFn": "close"
                }],
                    "pageFields": {
                        "size": 30,
                        dialogSize: 18
                    },
                
            },
            {"label": "详情", hookFn:'detail', link: "/detail?_query_={taskId: ${objId}}"},
            {  "label": "删除", "type": "danger", "isCustom": true, 
               "actOn": "table", "rangeFn": "onceFetch", /* "request": { "url": "/api/user/del/${id}", "method": "post", "successCb": { "rangeFn": "update", "request": {"url": "/user/query", "method": "post" }, "params": {}
                }} */
            },
            {
                "label": "下载", "actOn": "table", "rangeFn": "fetch", "btnClass": "add", "request": {
                    "url": '/auditPortal/telQYProcessResult/search',// "/auditPortal/common/attach/getTmp",
                    "method": "post",
                    // "responseType": "blob",
                    "downloadFormat": '.csv.gz',
                    "downloadNameField": 'taskName',
                    "fields": ['attachId', 'taskName'],
                    "beforeExcuteJsStr": "function(obj){obj.filename = obj.attachId;delete obj.attachId;return obj;}(obj)",
                    "fetchMsg": "下载请求已发送！"
                }
            },
            {
                "label": "上传", "title": "文件", "actOn": "dialog", "rangeFn": "open",
                "fields": [
                    { "label": "用户名称", "labelWidth": "70px", "prop": "taskId", "showIn":["table", "query"], "tag": "input", "config":
                        {
                            "clearable": true, "placeholder": "请输入用户名称"
                        }
                    },
                    {
                        "label": "导入文件", "prop": "file", "tag": "fileUpload", "config": {
                            "tip": "请上传文件",
                            "accept": "xlsx,xls",
                            "listType": "text",
                            "limit": 1,
                            "url": "/auditPortal/common/attach/upload", "headers": {
                                "Authorization": "Bearer " + localStorage.getItem("token")
                            }
                        }
                    },
                ],
                "operations": [
                    {
                        "label": "确认", "actOn": "dialog", "rangeFn": "commit", "isCloseDialog": true,
                        "request": {
                            "url": "/auditPortal/billDurationTask/createTask", "method": "post", "fields": ["attachId", "file", "objId"],
                            beforeExcuteJs: data => {
                                console.log('beforeExcuteJs---', data);
                                const { file } = data;
                                let key
                                file?.forEach(el => {
                                    key = el.response.resBody;
                                })
                                delete data.file;
                                data.attachId = key;
                                data.taskId = data.objId;
                                return data;
                            },
                            successMsg: "成功创建稽查任务",
                            successLogic: "obj?.returnCode == '0'",
                            successCb: {"actOn": "table", "rangeFn": "update", "request": {"url": "/auditPortal/billDurationTask/search", "method": "post", successMsg: "成功刷新列表", }}
                        }
                    }, {
                        "label": "取消", "rangeFn": "close", "actOn": "dialog", "isPlain": true
                    },
                ]
            },
        ],
        "query": [
            { "label": "重置","actOn": "query", "rangeFn": "reset", "btnClass": "reset" },
            { "label": "查询", "actOn": "table", "icon": 'search', "rangeFn": "update", "btnLoading": true, "request": {
                "url": "/auditPortal/telStatusTask/search",
                "method": "post",
                "params": {"pageNum": 1},
                beforeExcuteJs: data => {
                    data.objId = data.taskId;
                    // delete data.taskId;
                    return transfer.obj2Arr(query, data);
                },
                "beforeExcuteJsStr": "function(obj){return obj;}(obj)",
                "afterExcuteJsStr": "function(obj){obj.body.forEach((el,idx) => {el.name = {'a': idx}});console.log(obj);return obj;}(obj)"
            }
        }]
    },
    "config": {
        "table": {
            "pageFields": {
                "size": 30,
                dialogSize: 18
            },
        },
    }
}]
 
